package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.teaching.domain.PlatformCSpecialty;
import com.ruoyi.teaching.service.PlatformCSpecialtyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2024-06-13
 */
@RestController
@RequestMapping("/platform/specialty")
@Api(tags = "platform-专业管理")
public class PlatformCSpecialtyController {
    @Autowired
    private PlatformCSpecialtyService platformCSpecialtyService;

    /**
     * 查询专业 树状
     */
//    @PreAuthorize("@ss.hasPermi('platform:specialty:listTree')")
    @GetMapping("/listTree")
    @ApiOperation(value = "查询专业 树状", notes = "查询专业 树状")
    public AjaxResult listTree()
    {
        return platformCSpecialtyService.selectPlatformCSpecialtyListTree();
    }

    /**
     * 查询专业 大类
     */
//    @PreAuthorize("@ss.hasPermi('platform:specialty:listTop')")
    @GetMapping("/listTop")
    @ApiOperation(value = "查询专业 大类", notes = "查询专业 大类")
    public AjaxResult listTop()
    {
        return platformCSpecialtyService.selectPlatformCSpecialtyListTop();
    }

    /**
     * 查询备课授课专业列表
     */
//    @PreAuthorize("@ss.hasPermi('platform:specialty:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询专业 列表", notes = "查询专业 列表")
    public AjaxResult list()
    {
        return platformCSpecialtyService.selectPlatformCSpecialtyList();
    }

    /***
     * 根据id查询专业
     */

    @GetMapping("/{id}")
    @ApiOperation(value = "根据id查询专业", notes = "根据id查询专业")
    public AjaxResult getById(@PathVariable Integer id){
        return platformCSpecialtyService.getSpecialtyById(id);
    }

    /***
     * 根据大类id查询小类
     */
    @GetMapping("/getByBigId/{id}")
    @ApiOperation(value = "根据id查询专业", notes = "根据id查询专业")
    public AjaxResult getByBigId(@PathVariable("id") Integer id){
        return platformCSpecialtyService.getByBigId(id);
    }

}

